创建、删除设备,以及更新设备的部分信息。
注意:设备通用接口是对各种协议设备的公共属性进行操作。
功能描述:在物联网平台中新建一个设备(不支持LWM2M协议和网关设备),返回新建设备的id, apiKey, 用于该设备的信息鉴权。
POST /api/v1/devices
Query:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | Yes |
Body:
Name | Type | Description | Required |
---|---|---|---|
name | string | 设备名称 | Yes |
description | string | 设备描述 | No |
Body example:
{
"name": "device",
"description": "testDevice"
}
cURL example:
curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}&productId=100001' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "device",
"description": "testDevice"
}'
Response data:
Name | Type | Description |
---|---|---|
id | int | 设备ID |
apiKey | string | 设备KEY |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": {
"apiKey": "NGNlYTkxMDk1MDdjYWNkOGUyZjI=",
"id": 41
}
}
功能描述:查询物联网平台中的指定设备,返回该设备的详细信息,仅限基本属性(若设备有关联网关,则返回体中的parentid就是关联网关ID)。
GET /api/v1/devices/{deviceId}
Path:
Name | Type | Description | Required |
---|---|---|---|
deviceId | int | 设备ID | Yes |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/10000201?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
id | int | 设备ID |
name | string | 设备名 |
userId | string | 用户ID |
productId | int | 产品ID |
created | long | 创建时间 |
modified | long | 修改时间 |
description | string | 设备描述信息 |
adminState | int | 启用状态(0:禁用 / 1:启用 / 2:用户被禁用) |
operatingState | int | 在线状态(-1:无在线状态 / 0:离线 / 1:设备在线 / 2:网关在线 / 3:未激活) |
labels | string[] | 产品标签 |
lastConnected | long | 最近上线时间 |
lastReported | long | 最近上报状态的时间 |
location | string | 暂留 |
apiKey | string | 设备KEY |
protocolType | int | 协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA / 8:Bluetooth / 9:Zigbee) |
connectGatewayId | String | 当前连接的网关 |
encrypt | boolean | MQTT有效,是否加密(0:不加密 / 1:加密) |
parentid | int | 网关ID |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": {
"id": "116",
"apiKey": "ZTcyOTMxMWVmNWI1YzMwMDM5NDY=",
"productId": "33",
"name": "api_device_mu01",
"description": "api_device_mu01",
"adminState": 0,
"operatingState": 1,
"labels": [],
"lastConnected": 0,
"lastReported": 0,
"userId": "aa0a5029-e4a7-4216-a713-f7451fcc1e33",
"created": 156637312502341,
"modified": 115663731250143,
"protocolType": 1,
"connectGatewayId": "123484657",
"location": null,
"encrypt": false,
"parentid": 12345678
}
}
功能描述:更新物联网平台中的指定设备(不支持LWM2M协议)。
PUT /api/v1/devices/{deviceId}
Path:
Name | Type | Description | Required |
---|---|---|---|
deviceId | int | 设备ID | Yes |
Body:
Name | Type | Description | Required |
---|---|---|---|
name | string | 设备名称 | No |
description | string | 设备描述信息 | No |
Body example:
{
"name": "device",
"description": "testDevice"
}
cURL example:
curl --location --request PATCH '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/10000201?accessKeyId={accessKeyId}&signatureNonce=719&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "device",
"description": "testDevice"
}'
Response example:
{
"success": true,
"code": 0,
"msg": ""
}
功能描述:删除物联网平台中的指定设备(不支持LWM2M设备)。
DELETE /api/v1/devices/{deviceId}
Path:
Name | Type | Description | Required |
---|---|---|---|
deviceId | int | 设备ID | Yes |
cURL example:
curl --location --request DELETE '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/10000203?accessKeyId={accessKeyId}&signatureNonce=529&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response example:
{
"success": true,
"code": 0,
"msg": ""
}
功能描述:分页查询物联网平台设备列表,返回具体分页信息和设备列表。
GET /api/v1/devices/multi
Query:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | No |
pageSize | int | 分页大小 | Yes |
currentPage | int | 页码 | Yes |
name | string | 设备名称(模糊匹配) | No |
deviceId | int | 设备ID | No |
adminState | int | 启用状态(0:所有/ 1:禁用/ 2:启用) | No |
operatingState | int | 在线状态(0:所有 / 1:离线 / 2:在线 / 3:未激活),当参数adminState=1时,该查询条件无意义 | No |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/multi?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&productId=100001&pageSize=10¤tPage=1' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
currentPage | int | 当前页码 |
pageSize | int | 每页条数 |
totalCount | long | 总条数 |
totalPage | int | 总页数 |
content | struct[] | 当前页内容 |
Response data content的子对象结构体:
Name | Type | Description |
---|---|---|
id | int | 设备ID |
name | string | 设备名 |
userId | string | 用户ID |
productId | int | 产品ID |
productName | string | 产品名 |
created | long | 创建时间 |
modified | long | 修改时间 |
description | string | 设备描述信息 |
adminState | int | 启用状态(0:禁用 / 1:启用 / 2:用户被禁用) |
operatingState | int | 在线状态(-1:无在线状态 /0:离线 / 1:设备在线 / 2:网关在线 / 3:未激活) |
labels | string[] | 产品标签 |
lastConnected | long | 最近上线时间 |
lastReported | long | 最近上报状态的时间 |
location | string | 暂留 |
apiKey | string | 设备KEY |
protocolType | int | 协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA / 8:Bluetooth / 9:Zigbee) |
connectGatewayId | String | 当前连接的网关 |
encrypt | boolean | MQTT有效,是否加密(0:不加密 / 1:加密) |
parentid | int | 网关ID |
imei | string | 移动设备国际识别码,用于设备鉴权。填写内容需保持与设备内置信息一致。imei在产品下唯一 |
imsi | string | 国际移动用户识别码,用于区别移动用户的有效信息。填写需保持与SIM卡中信息一致 |
addressable | string | 寻址信息 |
psk | string | OneNET平台支持基于PSK(pre-shared key,预计共享秘钥)的DTLS加密,用于认证和数据安全传输。仅支持字母和数字,长度8~32。 |
Response example:
{
"data": {
"currentPage": 1,
"pageSize": 5,
"totalCount": 1,
"totalPage": 1,
"content": [
{
"id": 10013077,
"name": "nbd1",
"userId": null,
"productId": 101643,
"created": 1587720115599,
"modified": 1587720115599,
"description": null,
"adminState": 1,
"operatingState": 0,
"labels": null,
"lastConnected": 1588041986935,
"lastReported": null,
"location": null,
"apiKey": "OTk1ZGQ1NjZhNzhlZmU3NDU4NDU=",
"protocolType": 2,
"connectGatewayId": null,
"encrypt": null,
"productName": "nb111",
"subscription": null,
"authKey": null,
"psk": null,
"pskString": null,
"imei": "214135234",
"imsi": null,
"addressable": null,
"parentid": null
}
]
},
"success": true,
"code": 0,
"msg": null
}
功能描述:提供在物联网平台中批量创建设备的能力(不支持LWM2M协议和网关设备),返回设备信息列表,每项信息包含id和apiKey, 用于对应新建设备的信息鉴权。
注:设备创建数量上限为2000。
POST /api/v1/devices/multi
Query:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | Yes |
Body:
Name | Type | Description | Required |
---|---|---|---|
list | struct[] | 设备列表 | Yes |
list的子对象结构体:
Name | Type | Description | Required |
---|---|---|---|
name | string | 设备名称 | Yes |
description | string | 设备描述 | No |
Body example:
{"list":[
{
"name":"api_device_M02",
"description":"test device"
},
{
"name":"api_device_M03",
"description":"test device"
}
]}
cURL example:
curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/multi?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}&productId=100001' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{"list":[
{
"name":"api_device_M02",
"description":"test device"
},
{
"name":"api_device_M03",
"description":"test device"
}
]}'
Response data:
Name | Type | Description |
---|---|---|
data | struct[] | 设备列表 |
Response data data的子对象结构体:
Name | Type | Description |
---|---|---|
id | string | 设备ID |
apiKey | string | 设备KEY |
Response example:
resp
{
"success": true,
"code": 0,
"msg": "",
"data": [
{"id":114,
"apiKey":"NWVkM2Q2YjgwNzllMmU3ZTdiYWM="},
{"id":115,
"apiKey":"NmViYWFmYzY2Y2MwODc5YzcxYjU="
}]
}
功能描述:提供在物联网平台中批量删除设备的能力(不支持LWM2M),返回删除设备的数量。
DELETE /api/v1/devices
Query:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | Yes |
Body:
Name | Type | Description | Required |
---|---|---|---|
deviceIds | []int | 设备ID数组 | Yes |
Body example:
{
"deviceIds": [114, 115]
}
cURL example:
curl --location --request DELETE '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}&productId=100001' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceIds": [114, 115]
}'
Response data:
Name | Type | Description |
---|---|---|
data | int | 删除设备总量 |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": 2
}
功能描述:提供在物联网平台中批量启用指定产品下设备(不支持LWM2M)的能力。
PUT /api/v1/devices/unlock
Query:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | Yes |
Body:
Name | Type | Description | Required |
---|---|---|---|
deviceIds | []int | 设备ID数组 | Yes |
Body example:
{
"deviceIds": [118, 119]
}
cURL example:
curl --location --request PATCH '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/unlock?accessKeyId={accessKeyId}&signatureNonce=719&signature={signature}&productId=10001' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceIds": [118, 119]
}'
Response data:
Name | Type | Description |
---|---|---|
data | int | 启用设备总量 |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": "2"
}
功能描述:提供在物联网平台中批量启用指定产品下设备(不支持LWM2M)的能力。
PUT /api/v1/devices/lock
Query:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | Yes |
Body:
Name | Type | Description | Required |
---|---|---|---|
deviceIds | []int | 设备ID数组 | Yes |
Body example:
{
"deviceIds": [118, 119]
}
cURL example:
curl --location --request PATCH '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/lock?accessKeyId={accessKeyId}&signatureNonce=719&signature={signature}&productId=10001' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceIds": [118, 119]
}'
Response data:
Name | Type | Description |
---|---|---|
data | int | 禁用设备总量 |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": "2"
}
功能描述:分页获取批次列表。
GET /api/v1/products/batch/page
Query:
Name | Type | Description | Required |
---|---|---|---|
currentPage | int | 页码 | Yes |
pageSize | int | 分页大小 | Yes |
pid | int | 产品ID | No |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/products/batch/page?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&pageSize=10¤tPage=1&pid=1200000' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
currentPage | int | 当前页码 |
pageSize | int | 每页条数 |
totalCount | long | 总条数 |
totalPage | int | 总页数 |
content | struct[] | 当前页内容 |
Response data content的子对象结构体:
Name | Type | Description |
---|---|---|
count | int | 设备数量 |
id | int | 批次ID |
created | long | 创建时间 |
protocolType | int | 产品协议 |
Response example:
{
"code": 0,
"message": "成功",
"referInfo": null,
"data": {
"currentPage": 1,
"pageSize": 10,
"totalCount": 1,
"totalPage": 1,
"content": [
{
"id": 100184,
"count": 2,
"created": 1593420792282,
"protocolType": 1
}
]
}
}
功能描述:分页获取批次下的设备列表。
GET /api/v1/devices/batch/page
Query:
Name | Type | Description | Required |
---|---|---|---|
batchId | int | 批次id | Yes |
currentPage | int | 页码 | Yes |
pageSize | int | 分页大小 | Yes |
protocolType | int | 设备的协议类型(LWM2M时必传,值为2) | No |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/batch/page?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&batchId=10000502&pageSize=10¤tPage=1&protocolType=2' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
currentPage | int | 当前页码 |
pageSize | int | 每页条数 |
totalCount | long | 总条数 |
totalPage | int | 总页数 |
content | struct[] | 当前页内容 |
Response data content的子对象结构体:
Name | Type | Description |
---|---|---|
name | string | 设备名 |
adminState | int | 启用状态:0-禁用,1-启用,2-用户被禁用 |
description | string | 设备描述 |
s_version | string | OTA升级用,软件版本 |
f_version | string | OTA升级用,模组固件版本 |
id | int | 设备ID |
productId | int | 产品ID |
operatingState | int | 上下线状态(0:离线 / 1:设备在线 / 2:网关在线 / 3:未激活) |
apiKey | string | 设备key |
connectGatewayId | int | 当前连接的网关 |
lastReported | long | 最近上报状态的时间 |
modified | long | 更新时间 |
created | long | 创建时间 |
lastConnected | long | 最近上线时间 |
protocolType | int | 协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA / 8:Bluetooth / 9:Zigbee) |
encrypt | boolean | MQTT有效,是否加密(0:不加密 / 1:加密) |
deviceId | int | 设备id |
certSN | string | 证书序列号 |
certificate | string | 证书 |
privateKey | string | 证书密钥 |
productName | string | 产品名称 |
Response example:
{
"data": {
"currentPage": 1,
"pageSize": 5,
"totalCount": 2,
"totalPage": 1,
"content": [
{
"productId": 102584,
"apiKey": "ZDhkZmYxZTdhZWYwOTEwYTc0Y2E=",
"operatingState": 0,
"created": 1593420792282,
"certificate": "",
"description": "",
"protocolType": 4,
"certSN": "",
"deviceId": 0,
"s_version": "",
"productName": "modbus_product_1592192177443",
"privateKey": "",
"connectGatewayId": 0,
"lastConnected": 0,
"lastReported": 0,
"encrypt": false,
"f_version": "",
"name": "batch1_1",
"adminState": 1,
"modified": 1593420792282,
"id": 10017211
},
{
"productId": 102584,
"apiKey": "OGU2ODRjNDA3MmQxNzUwNjM1ODM=",
"operatingState": 0,
"created": 1593420792282,
"certificate": "",
"description": "",
"protocolType": 4,
"certSN": "",
"deviceId": 0,
"s_version": "",
"productName": "modbus_product_1592192177443",
"privateKey": "",
"connectGatewayId": 0,
"lastConnected": 0,
"lastReported": 0,
"encrypt": false,
"f_version": "",
"name": "batch1_2",
"adminState": 1,
"modified": 1593420792282,
"id": 10017212
}
]
},
"success": true,
"code": 0,
"msg": null
}
功能描述:分页查询当前物联网平台全部设备列表,返回具体分页信息和设备列表,仅限顶层用户使用。
GET /api/v1/devices/multi/all
Query:
Name | Type | Description | Required |
---|---|---|---|
pageSize | int | 分页大小,一次性允许最多查询1000个设备列表信息 | Yes |
currentPage | int | 页码 | Yes |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/multi/all?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&pageSize=100¤tPage=1' \
--header 'platform: 1'
Response data:
Name | Type | Description |
---|---|---|
currentPage | int | 当前页码 |
pageSize | int | 每页条数 |
totalCount | long | 总条数 |
totalPage | int | 总页数 |
content | struct[] | 当前页内容 |
Response data content的子对象结构体:
Name | Type | Description |
---|---|---|
id | int | 设备ID |
name | string | 设备名 |
userId | string | 用户ID |
productId | int | 产品ID |
productName | string | 产品名 |
created | long | 创建时间 |
modified | long | 修改时间 |
description | string | 设备描述信息 |
adminState | int | 启用状态(0:禁用 / 1:启用 / 2:用户被禁用) |
operatingState | int | 在线状态(-1:无在线状态 /0:离线 / 1:设备在线 / 2:网关在线 / 3:未激活) |
labels | string[] | 产品标签 |
lastConnected | long | 最近上线时间 |
lastReported | long | 最近上报状态的时间 |
location | string | 暂留 |
apiKey | string | 设备KEY |
protocolType | int | 协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA / 8:Bluetooth / 9:Zigbee) |
connectGatewayId | String | 当前连接的网关 |
encrypt | boolean | MQTT有效,是否加密(0:不加密 / 1:加密) |
parentid | int | 网关ID |
imei | string | 移动设备国际识别码,用于设备鉴权。填写内容需保持与设备内置信息一致。imei在产品下唯一 |
imsi | string | 国际移动用户识别码,用于区别移动用户的有效信息。填写需保持与SIM卡中信息一致 |
addressable | string | 寻址信息 |
psk | string | OneNET平台支持基于PSK(pre-shared key,预计共享秘钥)的DTLS加密,用于认证和数据安全传输。仅支持字母和数字,长度8~32。 |
Response example:
{
"data": {
"currentPage": 1,
"pageSize": 5,
"totalCount": 1,
"totalPage": 1,
"content": [
{
"id": 10013077,
"name": "nbd1",
"userId": null,
"productId": 101643,
"created": 1587720115599,
"modified": 1587720115599,
"description": null,
"adminState": 1,
"operatingState": 0,
"labels": null,
"lastConnected": 1588041986935,
"lastReported": null,
"location": null,
"apiKey": "OTk1ZGQ1NjZhNzhlZmU3NDU4NDU=",
"protocolType": 2,
"connectGatewayId": null,
"encrypt": null,
"productName": "nb111",
"subscription": null,
"authKey": null,
"psk": null,
"pskString": null,
"imei": "214135234",
"imsi": null,
"addressable": null,
"parentid": null
}
]
},
"success": true,
"code": 0,
"msg": null
}
功能描述:在物联网平台中新建一个LWM2M设备,返回新建设备的id, apiKey, 用于该设备的信息鉴权。
POST /api/v1/devices/lwm2m
Query:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | Yes |
Body:
Name | Type | Description | Required |
---|---|---|---|
name | string | 设备名称 | Yes |
imei | string | 移动设备国际识别码,用于设备鉴权。填写内容需保持与设备内置信息一致。imei在产品下唯一。 | Yes |
imsi | string | 国际移动用户识别码,用于区别移动用户的有效信息。填写需保持与SIM卡中信息一致。 | No |
authKey | string | 设备认证码 | No |
subscription | int | 自动订阅(0 : 否;1:是) | Yes |
psk | string | OneNET平台支持基于PSK(pre-shared key,预计共享秘钥)的DTLS加密,用于认证和数据安全传输。未填系统默认生成,仅支持字母和数字,长度8~32。 | No |
description | string | 设备描述 | No |
Body example:
{
"name": "nbDevice",
"imei": "0001",
"imsi": "",
"authKey": "12",
"subscription": 1,
"psk": "12345678",
"description": ""
}
cURL example:
curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/lwm2m?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}&productId=10001' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "nbDevice",
"imei": "0001",
"imsi": "",
"authKey": "12",
"subscription": 1,
"psk": "12345678",
"description": ""
}'
Response data:
Name | Type | Description |
---|---|---|
id | int | 设备ID |
apiKey | int | 设备KEY |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": {
"apiKey": "NGNlYTkxMDk1MDdjYWNkOGUyZjI=",
"id": "117"
}
}
功能描述:更新物联网平台中的指定LWM2M设备。
PUT /api/v1/devices/lwm2m/{deviceId}
Path:
Name | Type | Description | Required |
---|---|---|---|
deviceId | int | 设备ID | Yes |
Body:
Name | Type | Description | Required |
---|---|---|---|
name | string | 设备名称 | No |
imsi | string | 国际移动用户识别码,用于区别移动用户的有效信息。填写需保持与SIM卡中信息一致。 | No |
authKey | string | 设备认证码 | No |
subscription | int | 自动订阅(0 : 否;1:是) | No |
psk | string | OneNET平台支持基于PSK(pre-shared key,预计共享秘钥)的DTLS加密,用于认证和数据安全传输。仅支持字母和数字,长度8~32。 | No |
imei | string | 移动设备国际识别码,用于设备鉴权。填写内容需保持与设备内置信息一致。imei在产品下唯一。 | No |
description | string | 设备描述 | No |
Body example:
{
"name": "nbDevice01"
}
cURL example:
curl --location --request PATCH '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/lwm2m/10000203?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "nbDevice01"
}'
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data":1
}
功能描述:查询物联网平台中的指定LWM2M设备,返回该设备的详细信息。
GET /api/v1/devices/lwm2m/{deviceId}
Path:
Name | Type | Description | Required |
---|---|---|---|
deviceId | int | 设备ID | Yes |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/lwm2m/10000205?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
id | int | 设备ID |
name | string | 设备名 |
userId | string | 用户ID |
productId | int | 产品ID |
created | long | 创建时间 |
modified | long | 修改时间 |
description | string | 设备描述信息 |
adminState | int | 启用状态(0:禁用 / 1:启用 / 2:用户被禁用) |
operatingState | int | 上下线状态(0:离线 / 1:设备在线 / 2:网关在线 / 3:未激活) |
labels | string[] | 产品标签 |
lastConnected | long | 最近上线时间 |
lastReported | long | 最近上报状态的时间 |
location | string | 暂留 |
apiKey | string | 设备KEY |
protocolType | int | 协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA / 8:Bluetooth / 9:Zigbee) |
connectGatewayId | String | 当前连接的网关 |
encrypt | boolean | MQTT有效,是否加密(0:不加密 / 1:加密) |
parentId | int | 网关ID |
subscription | int | 自动订阅(0 : 否;1:是) |
authKey | String | 设备认证码 |
psk | String | OneNET平台支持基于PSK(pre-shared key,预计共享秘钥)的DTLS加密,用于认证和数据安全传输。仅支持字母和数字,长度8~32。 |
pskString | String | 对称加密 ,若psk为空,系统自动创建 |
imei | String | 移动设备国际识别码,用于设备鉴权。填写内容需保持与设备内置信息一致。imei在产品下唯一。 |
imsi | String | 国际移动用户识别码,用于区别移动用户的有效信息。填写需保持与SIM卡中信息一致。 |
addressable | String | 寻址信息 |
Response example:
{
"data": {
"id": 10010244,
"name": "nbtest1",
"userId": null,
"productId": 100570,
"created": 1577928293670,
"modified": 1577928293670,
"description": "",
"adminState": 1,
"operatingState": 0,
"labels": null,
"lastConnected": 0,
"lastReported": null,
"location": null,
"apiKey": "MmZiYTk4MWVjOTY0N2MxMTY3OTQ=",
"protocolType": 2,
"connectGatewayId": null,
"encrypt": null,
"subscription": 1,
"authKey": "",
"psk": "SBPibpR44ACAMikGgWwm7g/ECNImlInT3OHVGX9CFabCMY37vnSn5blLreaiK8rV",
"pskString": "d2a9623fc43f496f9b5167def16dfc3d",
"imei": "112w134",
"imsi": "",
"addressable": "",
"parentid": null
},
"success": true,
"code": 0,
"msg": null
}
功能描述:删除物联网平台中的指定LWM2M设备。
DELETE /api/v1/devices/lwm2m/{deviceId}
Path:
Name | Type | Description | Required |
---|---|---|---|
deviceId | int | 设备ID | Yes |
cURL example:
curl --location --request DELETE '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/lwm2m/10000205?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data":1
}
功能描述:提供在物联网平台中批量创建LWM2M设备的能力,返回设备信息列表,每项信息包含id和apiKey, 用于对应新建设备的信息鉴权。
注:设备创建数量上限为2000。
POST /api/v1/devices/lwm2m/multi
Query:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | Yes |
Body:
注:批量添加接口为数组结构,下表为单个结构信息
Name | Type | Description | Required |
---|---|---|---|
name | string | 设备名称 | Yes |
imei | string | 移动设备国际识别码,用于设备鉴权。填写内容需保持与设备内置信息一致。imei在产品下唯一。 | Yes |
imsi | string | 国际移动用户识别码,用于区别移动用户的有效信息。填写需保持与SIM卡中信息一致。 | No |
authKey | string | 设备认证码 | No |
subscription | int | 自动订阅(0 : 否;1:是) | Yes |
psk | string | OneNET平台支持基于PSK(pre-shared key,预计共享秘钥)的DTLS加密,用于认证和数据安全传输。未填系统默认生成,仅支持字母和数字,长度8~32。 | No |
description | string | 设备描述 | No |
Body example:
[
{
"name": "api_lwm2m_dev05",
"imei": "123",
"imsi": "",
"description": "",
"authKey": "",
"psk": "12345678",
"subscription": 1
},
{
"name": "api_lwm2m_dev06",
"imei": "",
"imsi": "",
"description": "",
"authKey": "",
"psk": "12345678",
"subscription": 1
}
]
cURL example:
curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/lwm2m/multi?accessKeyId={accessKeyId}&signatureNonce=719&signature={signature}&productId=10001' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"name": "api_lwm2m_dev05",
"imei": "123",
"imsi": "",
"description": "",
"authKey": "",
"psk": "12345678",
"subscription": 1
},
{
"name": "api_lwm2m_dev06",
"imei": "",
"imsi": "",
"description": "",
"authKey": "",
"psk": "12345678",
"subscription": 1
}
]'
Response data:
Name | Type | Description |
---|---|---|
data | struct[] | 当前页内容 |
Response data data的子对象结构体:
Name | Type | Description |
---|---|---|
id | int | 设备ID |
name | string | 设备名 |
userId | string | 用户ID |
productId | int | 产品ID |
created | long | 创建时间 |
modified | long | 修改时间 |
description | string | 设备描述信息 |
adminState | int | 启用状态(0:禁用 / 1:启用 / 2:用户被禁用) |
operatingState | int | 上下线状态(0:离线 / 1:设备在线 / 2:网关在线 / 3:未激活) |
labels | string[] | 产品标签 |
lastConnected | long | 最近上线时间 |
lastReported | long | 最近上报状态的时间 |
location | string | 暂留 |
apiKey | string | 设备KEY |
protocolType | int | 协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA / 8:Bluetooth / 9:Zigbee) |
connectGatewayId | String | 当前连接的网关 |
encrypt | boolean | MQTT有效,是否加密(0:不加密 / 1:加密) |
parentId | int | 网关ID |
subscription | int | 自动订阅(0 : 否;1:是) |
authKey | String | 设备认证码 |
psk | String | OneNET平台支持基于PSK(pre-shared key,预计共享秘钥)的DTLS加密,用于认证和数据安全传输。仅支持字母和数字,长度8~32。 |
pskString | String | 对称加密 ,若psk为空,系统自动创建 |
imei | String | 移动设备国际识别码,用于设备鉴权。填写内容需保持与设备内置信息一致。imei在产品下唯一。 |
imsi | String | 国际移动用户识别码,用于区别移动用户的有效信息。填写需保持与SIM卡中信息一致。 |
addressable | String | 寻址信息 |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": [
{
"id": 10000188,
"apiKey": "MDljMWQ4YjQwM2ExYjQwOTM3ZGI="
"productId": 100182,
"name": "api_lwm2m_dev06",
"imei": "0002",
"imsi": "",
"description": "",
"adminState": 1,
"operatingState": 1,
"lastConnected": 1,
"addressable": "",
"authKey": "12",
"psk": "12345678",
"subscription": 1,
"userId": "c8ec42ceb4c597a3ce7f0bbe",
"created": 15663173125028,
"modified": 1566373125028,
"connectGatewayId": "123268245645",
"encrypt": true
},
{
"id": 10000189,
"apiKey": "NjJmMWYxNGM1NDkzNzZmZTIwZTQ="
"productId": 100182,
"name": "api_lwm2m_dev06",
"imei": "0002",
"imsi": "",
"description": "",
"adminState": 1,
"operatingState": 1,
"lastConnected": 1,
"addressable": "",
"authKey": "12",
"psk": "12345678",
"subscription": 1,
"userId": "c8ec42ceb4c597a3ce7f0bbe",
"created": 15663173125028,
"modified": 1566373125028,
"connectGatewayId": "123268245645",
"encrypt": true
}
]
}
功能描述:提供在物联网平台中批量删除MQTT设备的能力,返回删除设备的数量。
DELETE /api/v1/devices/lwm2m
Query:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | Yes |
Body:
Name | Type | Description | Required |
---|---|---|---|
deviceIds | []int | 设备ID数组 | Yes |
Body example:
{
"deviceIds": [10000188, 10000189]
}
cURL example:
curl --location --request DELETE '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/lwm2m?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceIds": [10000188, 10000189]
}'
Response data:
Name | Type | Description |
---|---|---|
data | int | 删除设备数量 |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": 2
}
功能描述:提供在物联网平台中批量启用指定产品下设备的能力。
PUT /api/v1/devices/lwm2m/unlock
Body:
Name | Type | Description | Required |
---|---|---|---|
deviceIds | []int | 设备ID数组 | Yes |
Body example:
{
"deviceIds": [10000188, 10000189]
}
cURL example:
curl --location --request PATCH '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/lwm2m/unlock?accessKeyId={accessKeyId}&signatureNonce=719&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceIds": [10000188, 10000189]
}'
Response data:
Name | Type | Description |
---|---|---|
data | int | 启用设备数量 |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": "2"
}
功能描述:提供在物联网平台中批量启用指定产品下设备的能力。
PUT /api/v1/devices/lwm2m/lock
Body:
Name | Type | Description | Required |
---|---|---|---|
deviceIds | []int | 设备ID数组 | Yes |
Body example:
{
"deviceIds": [10000188, 10000189]
}
cURL example:
curl --location --request PATCH '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/lwm2m/lock?accessKeyId={accessKeyId}&signatureNonce=719&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceIds": [10000188, 10000189]
}'
Response data:
Name | Type | Description |
---|---|---|
data | int | 禁用设备数量 |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": "2"
}
功能描述:根据设备ID,查询物联网平台中的指定LWM2M设备下的资源。
GET /api/v1/devices/lwm2m/properties/{id}
Path:
Name | Type | Description | Required |
---|---|---|---|
id | int | 设备ID | Yes |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/lwm2m/properties/10000503?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
id | int | 属性ID |
deviceId | int | 设备ID |
instanceId | string | 实例ID |
instanceName | string | 实例名称 |
objectId | string | 对象ID |
objectName | string | 对象名称 |
propertyId | string | 属性ID |
propertyName | string | 属性名 |
propertyType | int | 属性类型(1:string / 2:bool / 3:int32 / 4:int64 / 5:float32 / 6:float64 / 7:bytes / 8:date / 9:enum) |
readable | int | 是否可读(0:不可读 / 1:可读) |
writable | int | 是否可写(0:不可写 / 1:可写) |
executable | int | 是否可执行(0:不可执行 / 1:可执行) |
created | long | 创建时间 |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": [{
"id": 344,
"objectId": "",
"objectName": "",
"instanceId": "",
"instanceName": "",
"propertyId": "3_0_9",
"propertyName": "BatteryLevel_3_0_9",
"propertyType": 8,
"executable": 0,
"readable": 1,
"writable": 0,
"deviceId": 10010167,
"created": 1567422728141
}]
}
功能描述:分页查询物联网平台中的指定LWM2M设备下的属性资源。
GET /api/v1/devices/lwm2m/properties
Query:
Name | Type | Description | Required |
---|---|---|---|
deviceId | int | LWM2M设备ID | Yes |
pageSize | int | 分页大小 | Yes |
currentPage | int | 页码 | Yes |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/lwm2m/properties?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&deviceId=10000502&pageSize=10¤tPage=1' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
currentPage | int | 当前页码 |
pageSize | int | 每页条数 |
totalCount | long | 总条数 |
totalPage | int | 总页数 |
content | struct[] | 当前页内容 |
Response data content的子对象结构体:
Name | Type | Description |
---|---|---|
id | int | 属性ID |
deviceId | int | 设备ID |
instanceId | string | 实例ID |
instanceName | string | 实例名称 |
objectId | string | 对象ID |
objectName | string | 对象名称 |
propertyId | string | 属性ID |
propertyName | string | 属性名 |
propertyType | int | 属性类型(1:string / 2:bool / 3:int32 / 4:int64 / 5:float32 / 6:float64 / 7:bytes / 8:date / 9:enum) |
readable | int | 是否可读(0:不可读 / 1:可读) |
writable | int | 是否可写(0:不可写 / 1:可写) |
executable | int | 是否可执行(0:不可执行 / 1:可执行) |
created | long | 创建时间 |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": {
"totalCount": 27,
"pageSize": 10,
"currentPage": 1,
"totalPage": 3,
"content": [{
"id": 281,
"objectId": "",
"objectName": "",
"instanceId": "",
"instanceName": "",
"propertyId": "3_0_9",
"propertyName": "BatteryLevel_3_0_9",
"propertyType": 8,
"executable": 0,
"readable": 1,
"writable": 0,
"deviceId": 10000154,
"created": 1568008647990
}]
}
功能描述:将一个或多个Modbus 设备关联到DTU设备作为其子设备。通过DTU设备可以实现命令和数据中转,下达至具体的Modbus子设备。
POST /api/v1/devices/dtu/associations/modbus
Query:
Name | Type | Description | Required |
---|---|---|---|
dtuId | int | DTU设备ID, | Yes |
dtuKey | string | DTU设备API Key | Yes |
productId | int | Modbus子设备产品ID | Yes |
masterKey | string | Modbus子设备产 品masterKey | Yes |
deviceIds | string | 子设备ID列表,逗号隔开 | Yes |
cURL example:
curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/dtu/associations/modbus?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&dtuId=10000503&dtuKey=110&productId=10001&masterKey=ZjBiNDY0MTk4NzYwYmM2NThkNWI=&deviceIds=10000502,10000503' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
deviceId | int | 设备ID |
parentId | int | 网关ID |
productId | int | 产品ID |
masterKey | string | 产品KEY |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": [
{
"deviceId": 10000115,
"parentId": 10000117,
"productId": 100110,
"masterKey": "ZTA0YzAxNmEyNDdiMzI0YTJjMWM="
}
]
}
功能描述:取消DTU设备和Modbus设备之间的关联。
DELETE /api/v1/devices/dtu/associations/modbus
Query:
Name | Type | Description | Required |
---|---|---|---|
dtuId | int | DTU设备ID, | Yes |
dtuKey | string | DTU设备API Key | Yes |
productId | int | Modbus子设备产品ID | Yes |
masterKey | string | Modbus子设备产品masterKey | Yes |
deviceIds | string | 子设备ID列表,逗号隔开 | Yes |
cURL example:
curl --location --request DELETE '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/dtu/associations/modbus?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&dtuId=10000503&dtuKey=110&productId=10001&masterKey=ZjBiNDY0MTk4NzYwYmM2NThkNWI=&deviceIds=10000502,10000503' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": 1
}
功能描述:查询DTU设备已关联的子设备
GET /api/v1/devices/subdevice/IN/page
Query:
Name | Type | Description | Required |
---|---|---|---|
currentPage | int | 当前页码 | Yes |
pageSize | int | 分页大小 | Yes |
deviceId | int | DTU设备的ID | No |
protocol | int | 子设备协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA) | Yes |
name | string | 子设备名,模糊查询 | No |
product | int | 产品ID | No |
adminState | int | 启用状态(0:全部 / 1:禁用 / 2:启用) | No |
operatingState | int | 在线状态(0:全部 / 1:离线 / 2:在线) | No |
parentId | Yes | DTU设备的ID | Yes |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/subdevice/IN/page?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&protocol=1&parentId=10000301&pageSize=10¤tPage=1' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
currentPage | int | 当前页码 |
pageSize | int | 每页条数 |
totalCount | long | 总条数 |
totalPage | int | 总页数 |
content | struct[] | 当前页内容 |
Response data content的子对象结构体:
Name | Type | Description |
---|---|---|
id | int | 设备ID |
name | string | 设备名 |
userId | string | 用户ID |
productId | int | 产品ID |
created | long | 创建时间 |
modified | long | 修改时间 |
description | string | 设备描述信息 |
adminState | int | 启用状态(0:禁用 / 1:启用 / 2:用户被禁用) |
operatingState | int | 上下线状态(0:离线 / 1:设备在线 / 2:网关在线 / 3:未激活) |
labels | string[] | 产品标签 |
lastConnected | long | 最近上线时间 |
lastReported | long | 最近上报状态的时间 |
location | string | 暂留 |
apiKey | string | 设备KEY |
protocolType | int | 协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA / 8:Bluetooth / 9:Zigbee) |
connectGatewayId | String | 当前连接的网关 |
encrypt | boolean | MQTT有效,是否加密(0:不加密 / 1:加密) |
parentId | int | 网关ID |
Response example:
{
"data": {
"currentPage": 1,
"pageSize": 5,
"totalCount": 1,
"totalPage": 1,
"content": [
{
"id": 10000247,
"name": "strdddd",
"userId": null,
"productId": 100048,
"created": 1568801094160,
"modified": 1568801094160,
"description": "string",
"adminState": 1,
"operatingState": 0,
"labels": null,
"lastConnected": 0,
"lastReported": 0,
"location": null,
"apiKey": "YTE1NTBhZDlkOGI2ZTliNmE4ZjY=",
"protocolType": 4,
"connectGatewayId": "0",
"encrypt": false
}
]
},
"success": true,
"code": 0,
"msg": null
}
功能描述:查询DTU设备未关联的子设备
GET /api/v1/devices/subdevice/NIN/page
Query:
Name | Type | Description | Required |
---|---|---|---|
currentPage | int | 当前页码 | Yes |
pageSize | int | 分页大小 | Yes |
deviceId | int | 设备 | No |
protocol | int | 子设备协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA / 8:Bluetooth / 9:Zigbee) | Yes |
name | string | 子设备名,模糊查询 | No |
product | int | 产品ID | Yes |
adminState | int | 启用状态(0:全部 / 1:禁用 / 2:启用) | No |
operatingState | int | 在线状态(0:全部 / 1:离线 / 2:在线) | No |
parentId | int | DTU设备的ID | Yes |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/subdevice/NIN/page?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&product=10001&protocol=1&parentId=10000301&pageSize=10¤tPage=1' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
currentPage | int | 当前页码 |
pageSize | int | 每页条数 |
totalCount | long | 总条数 |
totalPage | int | 总页数 |
content | struct[] | 当前页内容 |
Response data content的子对象结构体:
Name | Type | Description |
---|---|---|
id | int | 设备ID |
name | string | 设备名 |
userId | string | 用户ID |
productId | int | 产品ID |
created | long | 创建时间 |
modified | long | 修改时间 |
description | string | 设备描述信息 |
adminState | int | 启用状态(0:禁用 / 1:启用 / 2:用户被禁用) |
operatingState | int | 上下线状态(0:离线 / 1:设备在线 / 2:网关在线 / 3:未激活) |
labels | string[] | 产品标签 |
lastConnected | long | 最近上线时间 |
lastReported | long | 最近上报状态的时间 |
location | string | 暂留 |
apiKey | string | 设备KEY |
protocolType | int | 协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA / 8:Bluetooth / 9:Zigbee) |
connectGatewayId | String | 当前连接的网关 |
encrypt | boolean | MQTT有效,是否加密(0:不加密 / 1:加密) |
parentId | int | 网关ID |
Response example:
{
"data": {
"currentPage": 1,
"pageSize": 5,
"totalCount": 13,
"totalPage": 3,
"content": [
{
"id": 10000246,
"name": "bqqr",
"userId": null,
"productId": 100048,
"created": 1568799603921,
"modified": 1568799603921,
"description": "string22",
"adminState": 1,
"operatingState": 0,
"labels": null,
"lastConnected": 0,
"lastReported": 0,
"location": null,
"apiKey": "OTE0NDcyYmYwZjkxZTk1NTNmN2E=",
"protocolType": 4,
"connectGatewayId": "0",
"encrypt": false
},
{
"id": 10000244,
"name": "b67rr",
"userId": null,
"productId": 100048,
"created": 1568798437978,
"modified": 1568798437978,
"description": "string22",
"adminState": 1,
"operatingState": 0,
"labels": null,
"lastConnected": 0,
"lastReported": 0,
"location": null,
"apiKey": "OWFhMTAxOGRjMGU1YjBmNzc2NGY=",
"protocolType": 4,
"connectGatewayId": "0",
"encrypt": false
},
{
"id": 10000243,
"name": "13eqqd",
"userId": null,
"productId": 100048,
"created": 1568797352371,
"modified": 1568797352371,
"description": "string22",
"adminState": 1,
"operatingState": 0,
"labels": null,
"lastConnected": 0,
"lastReported": 0,
"location": null,
"apiKey": "ODlhMjgyOTJkMWZmZjA3OWE4MzE=",
"protocolType": 4,
"connectGatewayId": "0",
"encrypt": false
},
{
"id": 10000237,
"name": "13242986666222",
"userId": null,
"productId": 100048,
"created": 1568796141212,
"modified": 1568796141212,
"description": "string22",
"adminState": 1,
"operatingState": 0,
"labels": null,
"lastConnected": 0,
"lastReported": 0,
"location": null,
"apiKey": "YzVkYTE2ZTBjMGQ1NmRlY2I2NmM=",
"protocolType": 4,
"connectGatewayId": "0",
"encrypt": false
}
]
},
"success": true,
"code": 0,
"msg": null
}
功能描述:为Modbus设备创建一个DTU通道配置,根据此配置可以实现该设备数据的上传和下发。
注意:此接口多次调用会覆盖旧的Modbus设备DTU通道配置。
PUT /api/v1/devices/modbus/channel-config/dtu
body:
Name | Type | Description | Required |
---|---|---|---|
id | int | Modbus设备ID | Yes |
modbusAddress | int | 从站号 | Yes |
collectTime | int | 设备数据采集间隔 , 不小于10S | Yes |
Body example:
{
"collectTime": 8,
"id": 100001,
"modbusAddress": 101
}
cURL example:
curl --location --request PATCH '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/modbus/channel-config/dtu?accessKeyId={accessKeyId}&signatureNonce=719&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"collectTime": 8,
"id": 100001,
"modbusAddress": 101
}'
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": 1
}
功能描述:获取Modbus设备的DTU通道配置。
GET /api/v1/devices/modbus/channel-config/dtu
Query:
Name | Type | Description | Required |
---|---|---|---|
id | int | Modbus设备ID | Yes |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/devices/modbus/channel-config/dtu?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&id=10000506' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
id | int | Modbus设备ID |
modbusAddress | int | 从站号 |
collectTime | int | 设备数据采集间隔 , 不小于10S |
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": {
"id": 10000115,
"modbusAddress": 1,
"collectTime": 10
}
}